package com.nami.store.biz.conver.repository;

import com.nami.store.domain.ConversationDO;

import java.util.List;

/**
 * <p>
 * 会话 服务类
 * </p>
 *
 * @author lbc
 * @since 2023-08-01
 */
public interface ConverRepository {

    /**
     * 更新我自己
     *
     * @param myself
     * @return
     */
    boolean updateMySelfConver(ConversationDO myself);

    /**
     * 更新好友
     *
     * @return
     */
    boolean updateReceiverConver(ConversationDO conver);

    /**
     * @param conver
     * @return
     */
    boolean saveConver(ConversationDO conver);

    /**
     * @param senderId
     * @param receiverId
     * @return
     */
    boolean isExist(String senderId, String receiverId);

    /**
     * 更新 unreadIndex, sort_time, message_id
     *
     * @param conversation
     * @return
     */
    boolean updateGrpConvers(ConversationDO conversation);

    /**
     * 更新更多参数
     *
     * @param conversation
     * @return
     */
    boolean updateConver(ConversationDO conversation);

    /**
     * get one
     *
     * @param appKey
     * @param userId
     * @param targetId
     * @return
     */
    ConversationDO getConversation(String appKey, String userId, String targetId);

    /**
     * 获取多个
     *
     * @param appKey
     * @param userId
     * @param targetId
     * @return
     */
    List<ConversationDO> getConversByUserIds(String appKey, List<String> userId, String targetId);

    /**
     * batch
     *
     * @param convers
     * @return
     */
    boolean batchSave(List<ConversationDO> convers);

    /**
     * batch update
     *
     * @param itemList
     * @return
     */
    boolean batchUpdConvers(List<ConversationDO> itemList);


    boolean insertOrUpd(ConversationDO conver);

    /**
     * 获取我的会话
     *
     * @param appKey
     * @param userId
     * @param targetIds
     * @return
     */
    List<ConversationDO> getConversByUserIds(String appKey, String userId, List<String> targetIds);

}
